PM_FUNC_NORM_ATTRIB SKILL:SkillRockSlide( SKILL_CALL:iCall, Int:id )
{
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Rock Slide", .Type = TYPE_ROCK, .callTypes = CALL_BIND_DOWN|CALL_ENTITY_THINK, .PP = 10, .Charges = 1, .DelayTime = 1.0 );
		case CALL_HELP:     return SkillHelp( "Makes rocks fall where you are aiming." );
		case CALL_BIND_DOWN:
		{
			new Int:iRockCount = StatClamp( id, STAT_SPECIAL, 3, 7 );

			new Int:iDamage = StatClamp( id, STAT_ATTACK, 30, 70 )
			new Int:iEnt;

			new Coord:cAim[3], Vector:vAim[3];
			PlayerAimOrigin( id, cAim );

			for ( new Int:iRockNum; iRockNum < iRockCount; iRockNum++ )
			{
				CoordToVector( cAim, vAim );
				vAim[0] += random_float( -100.0, 100.0 );
				vAim[1] += random_float( -100.0, 100.0 );

				iEnt = EntitySkillCreate( .iPlayer = id,
										.iDamage = iDamage,
										.fRadius = 50.0,
										.fThinkTime = 0.1,
										.iProperty = SEP_THINK,
										.iMoveType = MOVETYPE_TOSS,
										.iSolidType = SOLID_BBOX,
										.iModel = MODEL_ROCK,
										.iSound = SOUND_TU_FIRE,
										.iSprite = SPRITE_XPLODE,
										.vOrigin = vAim,
										.vMins = Vector:{-5.0,-5.0,-5.0},
										.vMaxs = Vector:{5.0,5.0,5.0},
										.vVelocity = Vector:{0.0,0.0,1000.0}
										);

				UnStuck( iEnt, HULL_HEAD );

				//Make it invisible
				fm_set_rendering( iEnt, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 0 );

				EntitySetNum( iEnt, ENTITY_AOETYPE, AOE_IGNORE_ATTACKER|AOE_VICTIM_TEAM );
			}

			return SKILL_USED;
		}
		case CALL_ENTITY_THINK:
		{
			new Int:iEnt = g_iAttacker;
			new Vector:vVelocity[3];
			EntityGetVelocity( iEnt, vVelocity );
			if ( vVelocity[2] <= 0.0 )
			{
				EntitySetVelocity( iEnt, Vector:{0.0,0.0,0.0} );

				//Make it visible
				fm_set_rendering( iEnt, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255 );

				EntitySetFloat( iEnt, ENTITY_THINKTIME, 0.0 );
				EntitySetNum( iEnt, ENTITY_PROPERTIES, SEP_TOUCH|SEP_AOEDAMAGE|SEP_KILL );
			}
		}
	}
	return SKILL_READY;
}

PM_FUNC_NORM_ATTRIB SKILL:SkillRockThrow( SKILL_CALL:iCall, Int:id )
{
	switch( iCall )
	{
		case CALL_REGISTER: return SkillRegister( .Name = "Rock Throw", .Type = TYPE_ROCK, .callTypes = CALL_BIND_DOWN, .PP = 15, .Charges = 1, .DelayTime = 5.0 );
		case CALL_HELP:     return SkillHelp( "Throws a rock that explodes on contact." );
		case CALL_BIND_DOWN:
		{
			new Int:iEnt = EntitySkillCreate( .iPlayer = id,
											.iDamage = StatClamp( id, STAT_ATTACK, 30, 70 ),
											.fRadius = 50.0,
											.iProperty = SEP_TOUCH|SEP_AOEDAMAGE|SEP_KILL,
											.iMoveType = MOVETYPE_TOSS,
											.iSolidType = SOLID_BBOX,
											.iModel = MODEL_ROCK,
											.iSound = SOUND_TU_FIRE,
											.iSprite = SPRITE_XPLODE,
											.bPlayerOrigin = true,
											.bPlayerAngles = true,
											.vMins = Vector:{-10.0,-10.0,-10.0},
											.vMaxs = Vector:{10.0,10.0,10.0},
											.iAimVelocity = StatClamp( id, STAT_SPEED, 500, 1000 )
											);

			EntitySetNum( iEnt, ENTITY_AOETYPE, AOE_IGNORE_ATTACKER|AOE_VICTIM_TEAM );

			return SKILL_USED_PAUSE;
		}
	}
	return SKILL_READY;
}

